package toubiao.domain.po.business;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicUpdate;


@Entity
@Table(name = "reward")
@DynamicUpdate(true)
public class PoReward {

	private Long id;
	
	private Long sn;
	
	private String projectName;
	
	private String rewardName;
	
	private String profession;
	
	private String awardOrganization;
	
	private Date awardDate;
	
	private String projectCode;
	
	private String comment;
	
	private String type;
	
	private String grade;
	
	private PoProject project;
	
	private Set<PoRewardPhoto> rewardPhotoSet;

	//文号
	private String rewardSn;
	
	private Date registerDate;
	
	private double investAmount;
	
	private String designerNames;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getSn() {
		return sn;
	}

	public void setSn(Long sn) {
		this.sn = sn;
	}

	public double getInvestAmount() {
		return investAmount;
	}

	public void setInvestAmount(double investAmount) {
		this.investAmount = investAmount;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getRewardName() {
		return rewardName;
	}

	public void setRewardName(String rewardName) {
		this.rewardName = rewardName;
	}

	public String getProfession() {
		return profession;
	}

	public void setProfession(String profession) {
		this.profession = profession;
	}

	public String getAwardOrganization() {
		return awardOrganization;
	}

	public void setAwardOrganization(String awardOrganization) {
		this.awardOrganization = awardOrganization;
	}

	@Temporal(TemporalType.DATE)
	public Date getAwardDate() {
		return awardDate;
	}

	public void setAwardDate(Date awardDate) {
		this.awardDate = awardDate;
	}

	public String getProjectCode() {
		return projectCode;
	}

	public void setProjectCode(String projectCode) {
		this.projectCode = projectCode;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "project_id")
	public PoProject getProject() {
		return project;
	}

	public void setProject(PoProject project) {
		this.project = project;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "reward",cascade={CascadeType.REMOVE})
	public Set<PoRewardPhoto> getRewardPhotoSet() {
		return rewardPhotoSet;
	}

	public void setRewardPhotoSet(Set<PoRewardPhoto> rewardPhotoSet) {
		this.rewardPhotoSet = rewardPhotoSet;
	}
	
	public String getRewardSn() {
		return rewardSn;
	}

	public void setRewardSn(String rewardSn) {
		this.rewardSn = rewardSn;
	}

	public Date getRegisterDate() {
		return registerDate;
	}

	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	
	

	public String getDesignerNames() {
		return designerNames;
	}

	public void setDesignerNames(String designerNames) {
		this.designerNames = designerNames;
	}

	@Override
	public String toString() {
		return "Treward [id=" + id + ", sn=" + sn + ", projectName="
				+ projectName + ", rewardName=" + rewardName + ", profession="
				+ profession + ", awardOrganization=" + awardOrganization
				+ ", awardDate=" + awardDate + ", projectCode=" + projectCode
				+ ", comment=" + comment + ", type=" + type + ", grade="
				+ grade + ", project=" + project + "]";
	}
}
